package com.firefly.web.controller.admin.ums;

import com.firefly.web.controller.admin.ConsoleApiRestController;
import com.firefly.dao.dto.ums.LogDto;
import com.firefly.dao.vo.ums.LogListVo;
import com.firefly.service.command.ums.LogCommand;
import com.firefly.service.query.ums.LogQuery;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;

/**
 * @author 李志刚
 * @since 2020-04-02
 */
@ConsoleApiRestController("log")
public class LogController {
    private final LogQuery logQuery;
    private final LogCommand logCommand;
    @Autowired
    public LogController(LogQuery logQuery, LogCommand logCommand) {
        this.logQuery = logQuery;
        this.logCommand = logCommand;
    }

    @GetMapping("/list")
    public LogListVo getList(LogDto request) {
        return logQuery.getList(request);
    }

    @PostMapping("/clear")
    public Boolean postClear() {
        return logCommand.clear();
    }
}

